package com.xbongbong.admin.domain.entity;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.enums.DelEnum;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * 镜像阶段表
 * 
 * @author mingliang.cao
 * 
 * @date 2021-11-16
 */
@Getter
@Setter
public class MirrorStageEntity implements Serializable {
    private static final long serialVersionUID = -1339416159875709293L;
    /**
     * 主键
     */
    private Long id;

    /**
     * 镜像id
     */
    private Long mirrorId;

    /**
     * 镜像表单id
     */
    private Long mirrorFormId;

    /**
     * 镜像阶段流程id
     */
    private Long mirrorStageProcessId;

    /**
     * 原表单Id
     */
    private Long sourceFormId;

    /**
     * 原阶段流程Id
     */
    private Long sourceStageProcessId;

    /**
     * 原阶段Id
     */
    private Long sourceStageId;


    /**
     * 镜像表单saas标识
     */
    private Integer saasMark;

    /**
     * 镜像表单businessType
     */
    private Integer businessType;

    /**
     * 阶段名称
     */
    private String name;

    /**
     * 阶段code
     */
    private String code;

    /**
     * 阶段进入比例
     */
    private Integer intoProportion;

    /**
     * 阶段跳出比例
     */
    private Integer outProportion;

    /**
     * 阶段类型【0普通流程阶段、1结束阶段-成功、2结束阶段-失败】
     */
    private Integer type;

    /**
     * 阶段是否启用（0不启用、1启用）
     */
    private Integer enable;

    /**
     * 阶段排序【sort值越大代表阶段越靠前】
     */
    private Integer sort;

    /**
     * 阶段停留限制【无时间限制、停留多少时间后超时】
     */
    private Integer stayLimit;

    /**
     * 阶段停留限制时长
     */
    private Integer stayLimitTime;

    /**
     * 阶段停留限制时长单位
     */
    private Integer stayLimitTimeUnit;
    /**
     * 超时预警颜色是否开启【0关闭、1打开】
     */
    private Integer enableStageWarningColor;
    /**
     * 超时预警颜色
     */
    private String stageWarningColor;
    /**
     * 推进人，空值代表所有人都允许推进
     */
    private JSONArray executor;

    /**
     * 进入条件
     */
    private String preConditions;

    /**
     * 是否允许跳过阶段（0不允许、1允许）
     */
    private Integer allowSkipStage;

    /**
     * 是否关联业务状态（0没有关联、1有关联）
     */
    private Integer openStatus;

    /**
     * 关联业务的哪个状态
     */
    private Integer businessRelatedStatus;

    /**
     * 特殊业务的特殊阶段的额外设置
     */
    private JSONObject extraSetting;

    /**
     * 是否允许重新激活阶段流程（0不允许、1允许）
     */
    private Integer allowReactive;

    /**
     * 允许重新激活阶段流程到哪些阶段
     */
    private JSONArray allowReactiveStage;

    /**
     * 是否必填任务完成后自动跳入下一阶段（0否、1是）
     */
    private Integer enableAutoJump;

    /**
     * 允许从普通阶段直接跳转到结束阶段（0不允许、1允许）
     */
    private Integer enableJumpEnd;

    /**
     * 该阶段是否是默认值（0不是、1是）
     */
    private Integer isDefault;

    /**
     * 关联选项
     */
    private JSONArray linkOption;

    /**
     * 创建人
     */
    @Deprecated
    private String creatorId;

    /**
     * 创建时间
     */
    private Long addTime;

    /**
     * 更新时间
     */
    private Long updateTime;

    /**
     * 是否允许新建合同，阶段自动跳转此阶段
     * 0 不允许
     * 1 允许
     * null
     */
    private Integer allowCreateContractSkipStage;

    /**
     * 删除标记
     */
    private Integer del;

    public MirrorStageEntity() {
        del = 0;
    }

    public MirrorStageEntity(Long mirrorId, Long mirrorFormId, Long mirrorStageProcessId, Long sourceFormId, Long sourceStageProcessId, Long sourceStageId, Integer saasMark, Integer businessType, String name, String code, Integer intoProportion, Integer outProportion, Integer type, Integer enable, Integer sort, Integer stayLimit, Integer stayLimitTime, Integer stayLimitTimeUnit, Integer enableStageWarningColor, String stageWarningColor, String preConditions, Integer allowSkipStage, Integer openStatus, Integer businessRelatedStatus, JSONObject extraSetting, Integer allowReactive, Integer enableAutoJump, Integer enableJumpEnd, JSONArray allowReactiveStage, Integer isDefault, JSONArray linkOption, Integer allowCreateContractSkipStage) {
        this.mirrorId = mirrorId;
        this.mirrorFormId = mirrorFormId;
        this.mirrorStageProcessId = mirrorStageProcessId;
        this.sourceFormId = sourceFormId;
        this.sourceStageProcessId = sourceStageProcessId;
        this.sourceStageId = sourceStageId;
        this.saasMark = saasMark;
        this.businessType = businessType;
        this.name = name;
        this.code = code;
        this.intoProportion = intoProportion;
        this.outProportion = outProportion;
        this.type = type;
        this.enable = enable;
        this.sort = sort;
        this.stayLimit = stayLimit;
        this.stayLimitTime = stayLimitTime;
        this.stayLimitTimeUnit = stayLimitTimeUnit;
        this.enableStageWarningColor = enableStageWarningColor;
        this.stageWarningColor = stageWarningColor;
        this.preConditions = preConditions;
        this.allowSkipStage = allowSkipStage;
        this.openStatus = openStatus;
        this.businessRelatedStatus = businessRelatedStatus;
        this.extraSetting = extraSetting;
        this.allowReactive = allowReactive;
        this.allowReactiveStage = allowReactiveStage;
        this.enableAutoJump = enableAutoJump;
        this.enableJumpEnd = enableJumpEnd;
        this.isDefault = isDefault;
        this.linkOption = linkOption;
        this.setUpdateTime(DateTimeUtil.getInt());
        this.setAddTime(DateTimeUtil.getInt());
        this.setDel(DelEnum.NORMAL.getDel());
        this.allowCreateContractSkipStage = allowCreateContractSkipStage;
    }
}